#ifndef SIP_H
#define SIP_H

//#include "common.h"
#include "stm32f10x.h"

/* -------------------------------------- Datatype Defines -------------------------------------- */

typedef struct                                                 
{
	uint8_t    header[2];
	uint8_t    type[1];
	uint8_t    length[2];
	uint8_t    content_and_checksum[512];
}SIP_FRAME;

typedef struct
{
	uint32_t          state;
	uint32_t          pt;
	uint8_t           type;
	SIP_FRAME       	rxframe;
	uint16_t          length;
	uint16_t          content_length;
	uint16_t          checksum;
}SIP_PARSE_STATE;


extern SIP_FRAME Sip_createFrame(uint8_t type,uint8_t* content,uint16_t content_length);
extern uint32_t Sip_parseFrame(SIP_PARSE_STATE* parse_state, void (*handler_fun)(SIP_PARSE_STATE*), uint8_t rxdata);

#endif